/**
 * 万是一个标准单位。
 * 就是一万个比特
 * 相互转换的一些方法
 */

export default class Wan{


    static findWan(){
        return new Uint8Array(1250);
    }

    static  buffToWans(buff){
        let res=[]
        let dataBuff= new Uint8Array(buff);
        let length=0;
        if(dataBuff){
            while (dataBuff.byteLength-1250*length>0){
                let uint8array1=Wan.findWan();
                uint8array1.set(dataBuff.subarray(length*1250, length*1250+1250))
                res.push(uint8array1 )
                length++;
            }
        }

        return res;
    }

    static blocksToBuff(bolcks){
        let res=[];
        for(let i=0;i<bolcks.length;i++){
            res.push(...bolcks[i])
        }
        let dataBuff= new Uint8Array(res);
        return dataBuff;
    }

}